<template>
  <div>
    <!-- 编辑管理员 -->

    <!-- 面包屑导航 -->
    <Crumbs></Crumbs>

    <el-form status-icon ref="ruleForm" label-width="100px" class="demo-ruleForm" style="width: 500px">
      <el-form-item label="管理员姓名">
        <el-input v-model="row.username"></el-input>
      </el-form-item>
      <el-form-item label="账号">
        <el-input v-model="row.login"></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="pass">
        <el-input type="password" v-model="row.pwd"></el-input>
      </el-form-item>
      <el-form-item label="角色名称">
        <el-select v-model="row.role" placeholder="管理员">
          <el-option label="管理员" value="管理员"></el-option>
          <el-option label="发货员" value="发货员"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" class="form-btn" @click="open">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { getXmodifyAdminAdmin, getXAdminAdmin } from '../../../api'
import Crumbs from '../Crumbs.vue'
export default {
  data() {
    return {
      region: '',
      //数据
      username: '',
      loginnum: '',
      loginpass: '',
      store: '',
      role: '',
      row: '',
    }
  },
  methods: {
    open() {
      const obj = {
        id: this.row.id,
        username: this.row.username,
        login: this.row.login,
        pwd: this.row.pwd,
        shoplocation: this.row.shoplocation,
        role: this.row.role,
      }
      getXmodifyAdminAdmin(obj).then((res) => {
        console.log(res)
      })
      this.$router.push('/adminAdmin')
      getXAdminAdmin().then((res) => {
        console.log(res.data)
        // this.tableData=res.data
      })
    },
  },
  components: { Crumbs },
  created() {
    //获取信息
    if (this.$route.params.list == undefined) {
      this.$router.push('/adminAdmin')
    } else {
      console.log(this.$route.params.list)
      this.row = this.$route.params.list
    }
  },
}
</script>

<style></style>
